Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better exception msg for duplicated param names #1177

Merged
merged 1 commit into from
May 4, 2021

Conversation

uriyyo
Copy link
Contributor

@uriyyo uriyyo commented May 4, 2021

Raise ValueError with information about duplicated names instead of sre_constants.error.

For instance:

app = Starlette(
    routes=[
        Route("/api/users/{id}/groups/{id}", route),
    ]
)

Will raise:

ValueError: Duplicated param name id at path /api/users/{id}/groups/{id}

Instead of:

sre_constants.error: redefinition of group name 'id' as group 2; was group 1 at position 42

Copy link
Member

@tomchristie tomchristie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nicely done. 👍

@tomchristie tomchristie merged commit b7aeae7 into encode:master May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants